package com.ukao.pad.bean;


import android.os.Parcel;

import com.ukao.pad.utils.CheckUtils;


/**
 * 优惠券
 * Created by ukaodev on 2017/6/3.
 */

public class Coupons extends BaseListBean<Coupons> {


    public String mercId;//1,
    public long timeEnd;//1503652678000,
    public int amount;//null,
    public String orderId;//null,
    public String cityId;//1,
    public String storeId;//null,
    public String couponId;//8,
    public String userId;//1,
    public Integer fullAmount;//250,
    public long usedTime;//null,
    public long timeStart;//null,
    public Integer isOverdue;//1,
    public String statusText;//"已使用",
    public String status;//1
    private String couponRuleName;
    private int useStatus;
    private String useStatusText;

    public String name;
    public String type;
    public String valid_date;
    public String available_condition;
    public String credits;
    public String id;
    public String out_of_date;
    private int isValid;
    private boolean check;  /*选中*/

    private int enableUse;
    private  int useBalance;  //余额是否使用

    public int getUseBalance() {
        return useBalance;
    }

    public void setUseBalance(int useBalance) {
        this.useBalance = useBalance;
    }

    public boolean getEnableUse() {
        boolean IsOtAllow = false; /*1是可用*/
        if (enableUse == 1) {
            IsOtAllow = true;
        }
        return IsOtAllow;
    }


    public int getIsValid() {
        return isValid;
    }

    public void setEnableUse(int enableUse) {
        this.enableUse = enableUse;
    }

    public boolean getUseStatus() {
        boolean useStatu = false;
        if (useStatus == 1) {/*正式使用*/
            useStatu = true;

        }

        return useStatu;
    }


    public void setUseStatus(boolean useStatus) {
        if (useStatus) {
            this.useStatus = 1;
        } else {
            this.useStatus = 0;
        }


    }


    public String getUseStatusText() {


        return useStatusText;
    }

    public String getCouponRuleName() {
        return couponRuleName;
    }

    public String getMercId() {
        return mercId;
    }

    public long getTimeEnd() {
        return timeEnd;
    }

    public int getAmount() {
        return amount;
    }

    public String getOrderId() {
        return orderId;
    }

    public String getCityId() {
        return cityId;
    }

    public String getStoreId() {
        return storeId;
    }

    public String getCouponId() {
        return couponId;
    }

    public String getUserId() {
        return userId;
    }

    public Integer getFullAmount() {
        return fullAmount;
    }

    public long getUsedTime() {
        return usedTime;
    }

    public long getTimeStart() {
        return timeStart;
    }

    public boolean getIsOverdue() {
        boolean isValid = false;
        if (getIsValid() == 0) {/*过期*/
            isValid = true;

        }


        return isValid;
    }

    public String getStatusText() {
        return statusText;
    }

    public String getStatus() {
        return status;
    }

    public boolean isCheck() {
        return check;
    }

    public void setCheck(boolean check) {
        this.check = check;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValid_date() {
        return valid_date;
    }

    public void setValid_date(String valid_date) {
        this.valid_date = valid_date;
    }

    public String getAvailable_condition() {
        return available_condition;
    }

    public void setAvailable_condition(String available_condition) {
        this.available_condition = available_condition;
    }

    public String getCredits() {
        return credits;
    }

    public void setCredits(String credits) {
        this.credits = credits;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getOut_of_date() {
        return out_of_date;
    }

    public void setOut_of_date(String out_of_date) {
        this.out_of_date = out_of_date;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeString(this.mercId);
        dest.writeLong(this.timeEnd);
        dest.writeInt(this.amount);
        dest.writeString(this.orderId);
        dest.writeString(this.cityId);
        dest.writeString(this.storeId);
        dest.writeString(this.couponId);
        dest.writeString(this.userId);
        dest.writeValue(this.fullAmount);
        dest.writeLong(this.usedTime);
        dest.writeLong(this.timeStart);
        dest.writeValue(this.isOverdue);
        dest.writeString(this.statusText);
        dest.writeString(this.status);
        dest.writeString(this.couponRuleName);
        dest.writeInt(this.useStatus);
        dest.writeString(this.useStatusText);
        dest.writeString(this.name);
        dest.writeString(this.type);
        dest.writeString(this.valid_date);
        dest.writeString(this.available_condition);
        dest.writeString(this.credits);
        dest.writeString(this.id);
        dest.writeString(this.out_of_date);
        dest.writeInt(this.isValid);
        dest.writeByte(this.check ? (byte) 1 : (byte) 0);
        dest.writeInt(this.enableUse);
    }
    public Coupons() {
    }
    protected Coupons(Parcel in) {
        super(in);
        this.mercId = in.readString();
        this.timeEnd = in.readLong();
        this.amount = in.readInt();
        this.orderId = in.readString();
        this.cityId = in.readString();
        this.storeId = in.readString();
        this.couponId = in.readString();
        this.userId = in.readString();
        this.fullAmount = (Integer) in.readValue(Integer.class.getClassLoader());
        this.usedTime = in.readLong();
        this.timeStart = in.readLong();
        this.isOverdue = (Integer) in.readValue(Integer.class.getClassLoader());
        this.statusText = in.readString();
        this.status = in.readString();
        this.couponRuleName = in.readString();
        this.useStatus = in.readInt();
        this.useStatusText = in.readString();
        this.name = in.readString();
        this.type = in.readString();
        this.valid_date = in.readString();
        this.available_condition = in.readString();
        this.credits = in.readString();
        this.id = in.readString();
        this.out_of_date = in.readString();
        this.isValid = in.readInt();
        this.check = in.readByte() != 0;
        this.enableUse = in.readInt();
    }

    public static final Creator<Coupons> CREATOR = new Creator<Coupons>() {
        @Override
        public Coupons createFromParcel(Parcel source) {
            return new Coupons(source);
        }

        @Override
        public Coupons[] newArray(int size) {
            return new Coupons[size];
        }
    };
}
